package com.acoffee.java.aopAspectJ;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;

/**
 * @author acoffee
 * @create 2021-11-16 11:01
 */
public class LogAspect {
    public void log() {
        System.out.println("--------日志记录--------");
    }

    public void release() {
        System.out.println("--------释放资源--------");
    }

    public Object around(ProceedingJoinPoint joinPoint) {
        System.out.println("******之前******");
        Object proceed = null;
        try {
            proceed = joinPoint.proceed();
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }

        System.out.println("******之后******");

        return proceed;
    }

    public void afterAdvice(){
        System.out.println("最终通知！");
    }

}
